package cate.game.play.vo;

import cate.common.table.d.GDPlay;
import cate.game.play.fighter.FightAttrGroup;
import cate.game.play.fighter.HeroFighter;
import com.fasterxml.jackson.annotation.JsonInclude;
import easy.java.dev.note.NoteField;

import java.util.Set;

public class HeroFighterVO {

	@NoteField("原始英雄的uid")
	public String uid;

	@NoteField("战斗对象的剧本临时ID")
	public int pid;

	@NoteField("英雄tid")
	public int tid;

	@NoteField("阵型中的站位")
	public byte pos;

	@NoteField("等级")
	public int level;

	@NoteField("血量")
	public long hp;

	@NoteField("血量最大值")
	public long hpm;

	@NoteField("英雄属性组")
	@JsonInclude(JsonInclude.Include.NON_NULL)
	public FightAttrGroup attr;

	@NoteField("英雄技能")
	@JsonInclude(JsonInclude.Include.NON_NULL)
	public Set<Integer> skill;


	public HeroFighterVO read(HeroFighter fighter) {
		this.uid = fighter.uid;
		this.pid = fighter.getPid();
		this.tid = fighter.heroTid;
		this.pos = fighter.pos;
		this.level = fighter.level;
		this.hp = (long) fighter.attr.total().hpCur();
		this.hpm = (long) fighter.attr.total().hpTotal();
		if(GDPlay.ENABLE_PLAY_DETAIL){
			this.attr = fighter.attr;
			this.skill = fighter.skill.getSkillTids();
		}
		return this;
	}
}
